home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / fracts.doc < prev    next >
Text File  |  1995-03-31  |  3KB  |  96 lines

  1. (Comp.sys.handhelds) 
  2. Item: 4001 by _kingswood at hpcvbbs.cv.hp.com 
  3. Author: [Frank A. Vorstenbosch] 
  4.   Subj: HP48 Program for Fractional Numbers 
  5.   Date: Thu Sep 26 1991 
  6.  
  7. Hello NetLand, 
  8.   
  9. The following is a program to calculate with fractions, and allows you 
  10. to simplify fractional expressions. 
  11. Fractional numbers are entered and processed as symbolics, and as such 
  12. can be used in calculations. 
  13.   
  14. The three main programs are: 
  15.   
  16.    \->FR       Convert two reals to a simple fractional expression 
  17.                \->FR attempts a simpledivide first, and only when 
  18.                the result is a real, it retries in 'special-mode', 
  19.                so that it may be assigned to the divide key. 
  20.   
  21.    FR\->       Convert fractional expression to numerator and denominator 
  22.   
  23.    SIMPLIFY    Simplify a fractional expression 
  24.   
  25. There are two subroutines, recsimp and normalize. 
  26.   
  27. The SIMPLIFY routine currently allows the following operators and 
  28. functions, but can easily be expanded to include others. 
  29.  
  30.    +  -  /  *  NEG  INV  SQ  ABS  IP  FP  \v/  ^ 
  31.  
  32. [Note: \v/ is the square root symbol.  -jkh-] 
  33.  
  34. The result of \v/ and ^ must be rational to be allowed, so typing 
  35.    '1/2^(1/7)' SIMPLIFY 
  36. will not work.  SIMPLIFY will leave a mess on the stack in this case. 
  37.  
  38. Download the programs to your HP48, then PACK all SYSEVALS to Externals 
  39. using Joe Horns program.  [No need; I packed it for you.  -jkh-] 
  40.  
  41. When you have downloaded the appropriate file to your '48, type the 
  42. following for an example: 
  43.  
  44.    Enter the numbers 17 and 8: 
  45.   
  46.    2:            17           -- numerator 
  47.    1:             8           -- denominator 
  48.   
  49.    Press \-FR: 
  50.   
  51.    1:        '17/8'           -- fraction 
  52.   
  53.    Press SIMPLIFY: 
  54.   
  55.    1:       '2+1/8'           -- simplified fraction 
  56.   
  57.    Enter the fraction '1/3' by keying in 1 [Enter] 3 \->FR: 
  58.   
  59.    2:       '2+1/8' 
  60.    1:         '1/3' 
  61.   
  62.    Add the two by pressing [+] 
  63.   
  64.    1:   '2+1/8+1/3' 
  65.   
  66.    Duplicate this for later use, then press SIMPLIFY: 
  67.   
  68.    2:   '2+1/8+1/3' 
  69.    1:     '2+11/24' 
  70.   
  71.    Take fractional part, then multiply by typing FP [Enter] [*] 
  72.   
  73.    1: '(2+1/8+1/3)*FP(2+11/24)' 
  74.   
  75.    Simplify: 
  76.   
  77.    1:    '1+73/576' 
  78.   
  79.    Split into numerator and denominator using FR\-> 
  80.   
  81.    2:           649 
  82.    1:           576 
  83.   
  84.    And so on, ad nauseam. 
  85.   
  86. If I get enough positive comments on this, I will post a system-RPL 
  87. version some time in the future.  As well as making things faster, I 
  88. may also add more functions. 
  89.  
  90. BTW, AUTOCLOSEIO is a program that is called after each transfer from 
  91. within PDL which registers an alarm to exit from Kermit mode, and 
  92. performing a CLOSEIO. 
  93.  
  94. Note to Joe Horn:  This is PD, and if you like it you may place it on one 
  95. of your Goodies' Disks.  [Thanx, Frank!  -jkh-] 
  96.